package cn.lin.factory;

import java.math.BigDecimal;

/**
 * @author liufl E-mail:Huberier@allpyra.com
 * @version 创建时间：2017年8月16日 上午11:21:13
 * 类说明
 */
public class OperatorClient {

	public static void main(String[] args) throws Exception {
		OperatorSimpleFactory simpleFactory = new OperatorSimpleFactory();
		OperatorVo operator = simpleFactory.getOperator("*");
		operator.setPrice(new BigDecimal(2.266));
		operator.setSum(3);
		System.out.println("totalPrice="+operator.getResult());
		
		OperatorIFactory reduceFact = new OperatorFactoryRebateCounpon();
		OperatorVo optFact = reduceFact.getOperator();
		optFact.setPrice(new BigDecimal(100));
		optFact.setSum(3);
		System.out.println("totalPrice="+reduceFact.getResult(optFact));

		OperatorIFactory discountFact = new OperatorFactoryDiscount();
		OperatorVo discountVo = discountFact.getOperator();
		discountVo.setPrice(new BigDecimal(200));
		discountVo.setSum(3);
		System.out.println("totalPrice="+discountFact.getResult(discountVo));
	}
}

